package ru.silviasaint.fridge.server.bean;

import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
import java.util.List;

import ru.silviasaint.fridge.server.bean.impl.Data;
import ru.silviasaint.fridge.server.bean.impl.LocaledSubstance;

import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.field.ForeignCollectionField;
import com.j256.ormlite.table.DatabaseTable;
@DatabaseTable
public class Receipt extends LocaledSubstance{
	private Collection<Component> components;
	@DatabaseField(canBeNull = false, foreign = true )
	private User author;
	@DatabaseField(canBeNull = false, defaultValue = "0")
	private Integer rating;

	private List<Data> receiptData;
    @ForeignCollectionField(eager = true)
	private Collection<Tag> tags;
    @ForeignCollectionField(eager = true)
	private Collection<Rating> ratings;
	@DatabaseField(canBeNull = false)
	private boolean locked = false;
	@DatabaseField(canBeNull = false)
	private Date date = new Date();

	@DatabaseField
	private String originalName;
	private HashMap<String,String> nameTranslates;

	public String getOriginalName() {
		return originalName;
	}

	public void setOriginalName(String originalName) {
		this.originalName = originalName;
	}

	public HashMap<String, String> getNameTranslates() {
		return nameTranslates;
	}

	public void setNameTranslates(HashMap<String, String> nameTranslates) {
		this.nameTranslates = nameTranslates;
	}


	public Collection<Component> getComponents() {
		return components;
	}

	public void setComponents(Collection<Component> components) {
		this.components = components;
	}

	public User getAuthor() {
		return author;
	}

	public void setAuthor(User author) {
		this.author = author;
	}

	public Integer getRating() {
		return rating;
	}

	public void setRating(Integer rating) {
		this.rating = rating;
	}

	public List<Data> getReceiptData() {
		return receiptData;
	}

	public void setReceiptData(List<Data> receiptData) {
		this.receiptData = receiptData;
	}

	public boolean isLocked() {
		return locked;
	}

	public void setLocked(boolean locked) {
		this.locked = locked;
	}

	public Collection<Rating> getRatings() {
		return ratings;
	}

	public void setRatings(Collection<Rating> ratings) {
		this.ratings = ratings;
	}

	public Collection<Tag> getTags() {
		return tags;
	}

	public void setTags(Collection<Tag> tags) {
		this.tags = tags;
	}

	public Date getDate() {
		return date;
	}

	public void setDate(Date date) {
		this.date = date;
	}
}
